<template>
  <div class="content-block">
    <div class="info-head">{{ title }}</div>
    <div class="info-content">
      <v-chart :option="chartOption" style="width: 100%;height:360px;"></v-chart>
    </div>
  </div>
</template>

<script>
export default {
  name: 'bar-chart',
  props: ['title', 'unit'],
  computed: {
    chartOption () {
      return {
        color: ['#50fdfc', '#e6b00e'],
        legend: {
          left: 'center',
          top: 'bottom'
        },
        tooltip: {
          trigger: 'item'
        },
        xAxis: {
          type: 'category',
          data: ['2015', '2016', '2017', '2018'],
          axisLine: {
            lineStyle: {
              color: '#2b7ed6',
            }
          },
          splitLine: {
            lineStyle: {
              color: '#024287',
            }
          },
          axisLabel: {
            color: '#6b92b5',
          },
        },
        yAxis: {
          type: 'value',
          name: this.unit,
          axisLine: {
            lineStyle: {
              color: '#2b7ed6',
            }
          },
          splitLine: {
            lineStyle: {
              color: '#024287',
            }
          },
          axisLabel: {
            color: '#6b92b5',
          },
        },
        series: [
          {
            type: 'bar',
            data: Array(4).fill(1).map(() => Math.round(Math.random() * 99 + 1))
          }
        ]
      }
    }
  }
}
</script>

<style scoped>

</style>
